<!-- js validate form  -->
<script type="text/javascript">
$(document).ready(function() {
	 $("#target_2").focus(function() {
		 var target_1 = $("#target_1").val();
		 $(this).val(target_1); 
	 });
});

$(document).ready(function() {
	$("#add").validate();		
});

$.metadata.setType("attr", "validate");
</script>

<script type="text/javascript">
function check_form (){  
	var parent_id = document.forms["edit_form"]["parent_id"].value;

	if (parent_id == 0) {
		alert('Bạn phải chọn danh mục cha !');
		return false;		
	}
}
</script>

<div class="content_head">
	<?php echo $title; ?>
</div>

<form id="add" method="POST" name="edit_form" onsubmit="return  check_form ();" action="<?php echo base_url()?>back_end/category_product_2/edit/<?php echo $category_product_2_value['id']; ?>">
<div class="content_ct">
   <div class="content_ct_show">
		<table class="content_ct_show_add_tbl" width="100%">
			<tr>
				<td width="15%" style="text-align:right;">
					<span>Danh mục sản phẩm cấp 1: </span>
				</td>
				<td width="85%">
					<select name="parent_id" class="content_ct_search_tblselect" >
						<option value="0">------ Chọn danh mục sản phẩm cha ------</option>
						<?php
							foreach ($ct_1 as $ct_1_arr) { 
						?>
						<option value="<?php echo $ct_1_arr['id']; ?>" <?php if ($category_product_2_value['parent_id'] == $ct_1_arr['id']) { echo 'selected=selected';} ?>>
							<?php echo $ct_1_arr['name'];  ?>
						</option>
						<?php
							} 
						?>
					</select>
				</td>
			</tr>
			<tr>
				<td width="15%" style="text-align:right;">
					<span>Tên danh mục sản phẩm: </span>
				</td>
				<td width="85%">
					<input class="required input_txt_table required" name="name" value="<?php echo $category_product_2_value['name']; ?>" type="text" />
				</td>
			</tr>
			<tr>
				<td width="15%" style="text-align:right;">
					<span>Từ khóa: </span>
				</td>
				<td width="85%">
					<input class="required input_txt_table" value="<?php echo $category_product_2_value['keyword']; ?>" name="keyword" type="text" />
				</td>
			</tr>
			<tr>
				<td id="lk_tag" style="text-align:right;">
					<span>Trạng thái : </span>
				</td>
				<td>
					<input type="checkbox" name="status" value="1" <?php if( $category_product_2_value['status'] == 1) { echo 'checked=checked'; } ?>/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;">&nbsp;</td>
				<td>
					<input type="submit" name="editForm" style="cursor: pointer;" value="Sửa" />
					<input type="reset" style="cursor: pointer;" value="Reset" type="checkbox" />
				</td>
			</tr>
		</table>
	</div>
</div>
</form>